#!/usr/bin/perl -w
use strict;

print "Content-Type: text/html\n\n";
$_=$ENV{'QUERY_STRING'}||'';
print "<pre>You Ask\n<b>$_</b></pre>\n";

use DBI;
our $h=DBI->connect('DBI:mysql:database=Down','root') || die $DBI::errstr;

print("<font color='#990000'>cmd failed</font>"),exit unless /^id=(\d+)&prio=(\-?\d+)$/;
my ($id,$prio)=($1,$2);
print("<font color='#990000'>Prio failed</font>"),exit unless $prio=~/^(\-1|0|5|10)$/;

$h->do(qq/update down set prio=$prio where id=$id/);
$h->disconnect();

print "OK";
